﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartGrid.NET.WPFUtils.Interfaces
{
    public interface IEnumConverter<E>
        where E : struct
    {
        Dictionary<E, string> MapEnum2String { get; }
        Dictionary<string, E> MapString2Enum { get; }

        /// <summary>
        /// Used to convert collection of enums to collection of strings
        /// </summary>
        /// <param name="enums"></param>
        /// <returns></returns>
        string[] Convert(E[] enums);

        /// <summary>
        /// Used to convert enum to string
        /// </summary>
        /// <param name="vl"></param>
        /// <returns></returns>
        string Convert(E vl);

        /// <summary>
        /// Provide string to represent null enum.
        /// 
        /// Typically either New / Not Selected
        /// </summary>
        /// <returns></returns>
        string Convert();

        /// <summary>
        /// Convert string to enum or if no matching enum then null
        /// </summary>
        /// <param name="vl"></param>
        /// <returns></returns>
        E? Convert(string vl);
    }
}
